<template>
  <div id="Teleport">
    <button @click="ifOpen = true">Open</button>
    <teleport to="body">
      <div id="mask" v-if="ifOpen">
        <button @click="ifOpen = false">close</button>
      </div>
    </teleport>
  </div>
</template>

<script>
export default {
  data() {
    return {
      ifOpen: false,
    };
  },
};
</script>

<style lang="less" scoped>
#mask {
  width: 100%;
  height: 100vh;
  background-color: #00000024;
  position: absolute;
  top: 0;
  left: 0;
}
</style>